<?php

class Bootstrap
{

    private static $instance;
    private $setupObjs;
    private $output;
    private $template;

    private function __construct()
    {
        
    }

    public static function getInstance()
    {

        if (is_null(self::$instance))
        {
            self::$instance = new self();
        }

        return self::$instance;

    }

    public function init()
    {
        
        foreach ($this->setupObjs as $setupObj)
        {
            
            $setupObj->setup();
        }
        
        $this->output = Config::get('app.router')->process()->output();
        
        Setup_Abstract::getInstance('Setup_Assets')->setup();

        return self::getInstance();

    }

    public function addSetupObj(Setup_Interface $setupObj)
    {
        $this->setupObjs[] = $setupObj;

    }

    public function setRouter(Router_Abstract $router)
    {
        $this->router = $router;

    }

    public function getRouter()
    {
        return $this->router;

    }

    public function getTemplate()
    {
        return $this->template;

    }

    public function setTemplate($template = '')
    {
        $this->template = $template;

    }

    public function getOutput()
    {
        return $this->output;

    }

}